ani.options {animation}R Documentation

Set or Query Animation Parameters

Description

Set or query various parameters that control the behaviour of the animation, such as time interval, maximum frames, height and width, etc. This function is based on options to set an option ani which is a list containing the animation parameters.

Usage

ani.options(...)

Arguments

... arguments in tag = value form, or a list of tagged values. The tags must come from the animation parameters described below.

Value

a list containing the options.
When parameters are set, their former values are returned in an invisible named list. Such a list can be passed as an argument to ani.options to restore the parameter values.

Animation Parameters

interval
a positive number to set the time interval of the animation (unit in seconds).
nmax
maximum number of steps for a loop (e.g. iterations) to create animation frames. Note: the actual number of frames can be less than this number, depending on specific animations.
ani.width, ani.height
width and height of image frames (unit in px); see graphics devices like png, jpeg, ...
outdir
character: specify the output dir if we want to create HTML animation pages; default to be tempdir.
filename
character: name of the target HTML main file
withprompt
character: prompt to display while using ani.start (restore with ani.stop)
ani.type
character: image format for animation frames, e.g. png, jpg, ...
ani.dev
function: the graphics device; e.g. (png, jpeg, ...)
title
character: the title of animation
description
character: a description about the animation
footer
logical: if TRUE, write a foot part in the HTML page containing information such as date/time of creation; else don't write.
autobrowse
logical: whether auto-browse the animation page immediately after it is created?

Note

Please note that nmax is usually equal to the number of animation frames (e.g. for brownian.motion) but not always! The reason is that sometimes there are more than one frame recorded in a single step of a loop, for instance, there are 2 frames generated in each step of kmeans.ani, and 4 frames in knn.ani, etc.

This function can be used for almost all the animation functions such as brownian.motion, boot.iid, buffon.needle, cv.ani, flip.coin, kmeans.ani, knn.ani, etc. All the parameters will affect the behaviour of HTML animations, but only interval will affect animations in windows graphics device.

Author(s)

Yihui Xie

References

http://animation.yihui.name/animation:options

See Also

options

Examples

## Not run: 
# store the old option to restore it later
oopt = ani.options(interval = 0.05, nmax = 100, ani.dev = png, ani.type = "png")
ani.start() 
opar = par(mar = c(3, 3, 2, 0.5), mgp = c(2, .5, 0), tcl = -0.3,
    cex.axis = 0.8, cex.lab = 0.8, cex.main = 1) 
brownian.motion( pch = 21, cex = 5, col = "red", bg = "yellow",
    main = "Demonstration of Brownian Motion",)
par(opar)
ani.stop() 
ani.options(oopt)
## End(Not run)

[Package animation version 1.0-1 Index]